

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>ccqw.coordWidget &mdash; CCQW 0.1.1 documentation</title>
    
    <link rel="stylesheet" href="../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '0.1.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <script type="text/javascript" src="../../_static/sidebar.js"></script>
    <link rel="top" title="CCQW 0.1.1 documentation" href="../../index.html" />
    <link rel="up" title="Module code" href="../index.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li><a href="../../index.html">CCQW 0.1.1 documentation</a> &raquo;</li>
          <li><a href="../index.html" accesskey="U">Module code</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <h1>Source code for ccqw.coordWidget</h1><div class="highlight"><pre>
<span class="c"># -*- coding: utf-8 -*-</span>
<span class="c">#from IPython import embed; embed()</span>
<span class="sd">&quot;&quot;&quot; A widget for (phi, lamda, h) or (easting, northing, h) coordinates</span>

<span class="sd">The CoordWidget class implement a widget to display coordinates:  (lat, lon,</span>
<span class="sd">height) or (easting, northing height).</span>
<span class="sd">The widget has optional combo boxes both for degrees representation (D.DD or</span>
<span class="sd">D, M.MM or D, M, S.SS) and height (ellipsoidical or orthometric).</span>
<span class="sd">The appearance of the widget (phi, lamda, h) or (easting, northing, h) depends</span>
<span class="sd">on the Projection used.</span>

<span class="sd">    :Author:</span>
<span class="sd">      - 20111221-20120214 Roberto Vidmar</span>

<span class="sd">    :Revision:  $Revision: 52 $</span>
<span class="sd">                $Date: 2012-11-12 10:07:15 +0100 (Mon, 12 Nov 2012) $</span>

<span class="sd">    :Copyright: 2011-2012</span>
<span class="sd">                Nicola Creati &lt;ncreati@inogs.it&gt;</span>
<span class="sd">                Roberto Vidmar &lt;rvidmar@inogs.it&gt;</span>

<span class="sd">    :License: MIT/X11 License (see :download:`license.txt</span>
<span class="sd">                               &lt;../../license.txt&gt;`)</span>
<span class="sd">&quot;&quot;&quot;</span>

<span class="kn">import</span> <span class="nn">sys</span>
<span class="kn">from</span> <span class="nn">pyproj</span> <span class="kn">import</span> <span class="n">__version__</span><span class="p">,</span> <span class="n">Proj</span>
<span class="kn">from</span> <span class="nn">qtCompat</span> <span class="kn">import</span> <span class="n">Qt</span><span class="p">,</span> <span class="n">Signal</span><span class="p">,</span> <span class="n">QtCore</span><span class="p">,</span> <span class="n">QtGui</span>

<span class="n">QCA</span> <span class="o">=</span> <span class="n">QtCore</span><span class="o">.</span><span class="n">QCoreApplication</span>
<span class="kn">from</span> <span class="nn">geodesy</span> <span class="kn">import</span> <span class="n">DatumShift</span><span class="p">,</span> <span class="n">Geoid</span>
<span class="kn">from</span> <span class="nn">degreesWidget</span> <span class="kn">import</span> <span class="n">DegreesWidget</span>
<span class="kn">from</span> <span class="nn">heightWidget</span> <span class="kn">import</span> <span class="n">HeightWidget</span>
<span class="kn">from</span> <span class="nn">projectedWidget</span> <span class="kn">import</span> <span class="n">ProjectedWidget</span>
<span class="kn">from</span> <span class="nn">filePicker</span> <span class="kn">import</span> <span class="n">FilePicker</span>
<span class="kn">from</span> <span class="nn">projDialog</span> <span class="kn">import</span> <span class="p">(</span><span class="n">ProjDialog</span><span class="p">,</span> <span class="n">DATUMSHIFT_KEYWORD</span><span class="p">,</span> <span class="n">GEOIDGRIDS_KEYWORD</span><span class="p">,</span>
  <span class="n">EXTRA_KEYWORDS</span><span class="p">)</span>

<div class="viewcode-block" id="TinyButton"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.TinyButton">[docs]</a><span class="k">class</span> <span class="nc">TinyButton</span><span class="p">(</span><span class="n">QtGui</span><span class="o">.</span><span class="n">QPushButton</span><span class="p">):</span>
  <span class="sd">&quot;&quot;&quot; A QPushButton with a size fitted to the button label</span>
<span class="sd">  &quot;&quot;&quot;</span>
<div class="viewcode-block" id="TinyButton.__init__"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.TinyButton.__init__">[docs]</a>  <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">label</span><span class="p">,</span> <span class="n">parent</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Create a new TinyButton instance.</span>

<span class="sd">    :param label: label to put on the tiny button</span>
<span class="sd">    :type label: string</span>
<span class="sd">    :param parent: parent widget</span>
<span class="sd">    :type parent: QtGui widget</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="nb">super</span><span class="p">(</span><span class="n">TinyButton</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="n">label</span><span class="p">,</span> <span class="n">parent</span><span class="p">)</span>

    <span class="n">textWidth</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fontMetrics</span><span class="p">()</span><span class="o">.</span><span class="n">boundingRect</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">text</span><span class="p">())</span><span class="o">.</span><span class="n">width</span><span class="p">()</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">setMaximumWidth</span><span class="p">(</span><span class="n">textWidth</span> <span class="o">+</span> <span class="mi">12</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">setFocusPolicy</span><span class="p">(</span><span class="n">Qt</span><span class="o">.</span><span class="n">NoFocus</span><span class="p">)</span>

<span class="c">#===============================================================================</span></div></div>
<div class="viewcode-block" id="CoordWidget"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget">[docs]</a><span class="k">class</span> <span class="nc">CoordWidget</span><span class="p">(</span><span class="n">QtGui</span><span class="o">.</span><span class="n">QWidget</span><span class="p">):</span>
  <span class="sd">&quot;&quot;&quot; A widget for (phi, lamda, h) or (easting, northing, h) coordinates.</span>
<span class="sd">  &quot;&quot;&quot;</span>
  <span class="n">WGS84</span> <span class="o">=</span> <span class="s">&#39;+proj=latlong +datum=WGS84&#39;</span>
  <span class="n">changedSignal</span> <span class="o">=</span> <span class="n">Signal</span><span class="p">(</span><span class="nb">object</span><span class="p">)</span>
  <span class="n">fileChangedSignal</span> <span class="o">=</span> <span class="n">Signal</span><span class="p">(</span><span class="nb">object</span><span class="p">)</span>

  <span class="c"># Initial visualization Mode</span>
  <span class="n">ModeD</span> <span class="o">=</span> <span class="mi">0</span>
  <span class="n">ModeDM</span> <span class="o">=</span> <span class="mi">1</span>
  <span class="n">ModeDMS</span> <span class="o">=</span> <span class="mi">2</span>
  <span class="n">ModeFile</span> <span class="o">=</span> <span class="mi">3</span>

  <span class="c"># Height</span>
  <span class="n">RepEll</span> <span class="o">=</span> <span class="mi">0</span>
  <span class="n">RepOrtho</span> <span class="o">=</span> <span class="mi">1</span>

  <span class="c"># Stacked Widget: Plane or Geographic</span>
  <span class="n">PlaneIndex</span> <span class="o">=</span> <span class="mi">0</span>
  <span class="n">GeographicIndex</span> <span class="o">=</span> <span class="mi">1</span>

  <span class="c"># Stacked Widget: Point or File</span>
  <span class="n">PointIndex</span> <span class="o">=</span> <span class="mi">0</span>
  <span class="n">FileIndex</span> <span class="o">=</span> <span class="mi">1</span>

<div class="viewcode-block" id="CoordWidget.__init__"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.__init__">[docs]</a>  <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">xyz</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">labels</span><span class="o">=</span><span class="p">(</span>
      <span class="s">u&quot;</span><span class="se">\N{GREEK SMALL LETTER PHI}</span><span class="s">&quot;</span><span class="p">,</span> <span class="s">u&quot;</span><span class="se">\N{GREEK SMALL LETTER LAMDA}</span><span class="s">&quot;</span><span class="p">,</span> <span class="s">u&quot;H&quot;</span><span class="p">,</span>
      <span class="s">u&quot;E&quot;</span><span class="p">,</span> <span class="s">u&quot;N&quot;</span><span class="p">,</span> <span class="s">u&quot;Input File&quot;</span><span class="p">,</span> <span class="s">u&quot;Output File&quot;</span><span class="p">),</span>
      <span class="n">initMode</span><span class="o">=</span><span class="n">ModeD</span><span class="p">,</span>
      <span class="n">repH</span><span class="o">=</span><span class="n">RepEll</span><span class="p">,</span> <span class="n">ell2Ortho</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
      <span class="n">name</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="n">proj</span><span class="o">=</span><span class="n">WGS84</span><span class="p">,</span> <span class="n">comboU</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="n">comboH</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Create a new instance of the widget.</span>

<span class="sd">      :param xyz: Tuple (x, y, z) where: x = Easting or longitude,</span>
<span class="sd">                  y = Northing or latitude, z = Ellipsoidical height</span>
<span class="sd">      :type xyz: tuple</span>

<span class="sd">      :param labels: labels to use for the different forms of the widget:</span>
<span class="sd">                     (φ, λ, H, E, N, InputFPCaption, OutputFPCaption)</span>
<span class="sd">      :type label: tuple</span>
<span class="sd">      :param initMode: Initial representation:</span>
<span class="sd">                       ModeD = D.DD or M.MM</span>
<span class="sd">                       ModeDM = D M.MM</span>
<span class="sd">                       ModeDMS = D M S.SS</span>
<span class="sd">                       ModeFile = File</span>
<span class="sd">      :type initMode: int</span>
<span class="sd">      :param repH: representation for height: RepEll = ell, RepOrtho = ortho</span>
<span class="sd">      :type repH: int</span>
<span class="sd">      :param ell2Ortho: offset to add to z to obtain orthometric height</span>
<span class="sd">      :type ell2Ortho: float</span>
<span class="sd">      :param name: optional name of this object</span>
<span class="sd">      :type name: string, unicode</span>
<span class="sd">      :param proj: Datum / Projection of xyz in PROJ.4 string form (default is</span>
<span class="sd">                   WGS84)</span>
<span class="sd">      :type proj: PROJ.4 string</span>
<span class="sd">      :param comboU: Add a combo box to select degrees representation</span>
<span class="sd">                     Default: True, Values: (False, True, &#39;File&#39;)</span>
<span class="sd">      :type comboU: bool or string</span>
<span class="sd">      :param comboH: Add a combo box to select height representation</span>
<span class="sd">      :type comboH: bool (default True)</span>
<span class="sd">  &quot;&quot;&quot;</span>
    <span class="nb">super</span><span class="p">(</span><span class="n">CoordWidget</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">__init__</span><span class="p">()</span>

    <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span> <span class="o">=</span> <span class="n">xyz</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">_ell2ortho</span> <span class="o">=</span> <span class="n">ell2Ortho</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">_hasComboU</span> <span class="o">=</span> <span class="n">comboU</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">_hasComboH</span> <span class="o">=</span> <span class="n">comboH</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">_filePickerLabels</span> <span class="o">=</span> <span class="n">labels</span><span class="p">[</span><span class="mi">5</span><span class="p">:</span> <span class="mi">7</span><span class="p">]</span>

    <span class="c"># Set object&#39;s name</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">setObjectName</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>

    <span class="c"># Optional Datum Shift instead of +towgs84</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">_datumShift</span> <span class="o">=</span> <span class="bp">None</span>
    <span class="c"># Optional Geoid Grid to add to +towgs84</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">_geoidGrid</span> <span class="o">=</span> <span class="bp">None</span>

    <span class="c"># Height</span>
    <span class="n">heightHLayout</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QHBoxLayout</span><span class="p">()</span>
    <span class="n">hLabel</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QLabel</span><span class="p">(</span><span class="n">labels</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
    <span class="n">hLabel</span><span class="o">.</span><span class="n">setToolTip</span><span class="p">(</span><span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;hLabelTooltip&quot;</span><span class="p">,</span> <span class="s">&quot;Height&quot;</span><span class="p">))</span>
    <span class="n">heightHLayout</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="n">hLabel</span><span class="p">,</span> <span class="n">alignment</span><span class="o">=</span><span class="n">Qt</span><span class="o">.</span><span class="n">AlignLeft</span><span class="o">|</span><span class="n">Qt</span><span class="o">.</span><span class="n">AlignVCenter</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span> <span class="o">=</span> <span class="n">HeightWidget</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">z</span><span class="p">,</span> <span class="n">ell2Ortho</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_ell2ortho</span><span class="p">,</span>
      <span class="n">rep</span><span class="o">=</span><span class="n">repH</span><span class="p">)</span>
    <span class="n">heightHLayout</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="p">)</span>
    <span class="n">heightHLayout</span><span class="o">.</span><span class="n">setContentsMargins</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>

    <span class="c"># phi, lamda</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">_mode</span> <span class="o">=</span> <span class="n">initMode</span>
    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_mode</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModeFile</span><span class="p">:</span>
     <span class="n">rep</span> <span class="o">=</span> <span class="n">DegreesWidget</span><span class="o">.</span><span class="n">DDD</span>
    <span class="k">else</span><span class="p">:</span>
     <span class="n">rep</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_mode</span>

    <span class="bp">self</span><span class="o">.</span><span class="n">_rep</span> <span class="o">=</span> <span class="n">rep</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">latWidget</span> <span class="o">=</span> <span class="n">DegreesWidget</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">latitude</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">rep</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_rep</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">lonWidget</span> <span class="o">=</span> <span class="n">DegreesWidget</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">latitude</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">rep</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_rep</span><span class="p">)</span>

    <span class="c"># Easting, Northing</span>
    <span class="n">easting</span> <span class="o">=</span> <span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;easting&quot;</span><span class="p">,</span> <span class="s">&quot;Easting&quot;</span><span class="p">)</span>
    <span class="n">northing</span> <span class="o">=</span> <span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;northing&quot;</span><span class="p">,</span> <span class="s">&quot;Northing&quot;</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">eWidget</span> <span class="o">=</span> <span class="n">ProjectedWidget</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="n">easting</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">nWidget</span> <span class="o">=</span> <span class="n">ProjectedWidget</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="n">northing</span><span class="p">)</span>

    <span class="c"># File Picker</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">_filePicker</span> <span class="o">=</span> <span class="n">FilePicker</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span>
      <span class="n">filt</span><span class="o">=</span><span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;FilePicker&quot;</span><span class="p">,</span> <span class="s">&quot;XYZ files (*.xyz);;All Files (*)&quot;</span><span class="p">))</span>

    <span class="c"># Connect signals</span>
    <span class="k">for</span> <span class="n">w</span> <span class="ow">in</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">latWidget</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">lonWidget</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="p">,</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">eWidget</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">nWidget</span><span class="p">):</span>
      <span class="n">w</span><span class="o">.</span><span class="n">textEditedSignal</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pointChanged</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">_filePicker</span><span class="o">.</span><span class="n">pathChanged</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fpChanged</span><span class="p">)</span>

    <span class="c"># Now build the coordinates widgets</span>
    <span class="n">xx</span> <span class="o">=</span> <span class="p">((</span><span class="n">labels</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">labels</span><span class="p">[</span><span class="mi">3</span><span class="p">]),</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">latWidget</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">eWidget</span><span class="p">),</span>
      <span class="p">(</span><span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;latwidget&quot;</span><span class="p">,</span> <span class="s">&quot;Latitude&quot;</span><span class="p">),</span> <span class="n">easting</span><span class="p">))</span>
    <span class="n">yy</span> <span class="o">=</span> <span class="p">((</span><span class="n">labels</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">labels</span><span class="p">[</span><span class="mi">4</span><span class="p">]),</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">lonWidget</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">nWidget</span><span class="p">),</span>
      <span class="p">(</span><span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;lonwidget&quot;</span><span class="p">,</span> <span class="s">&quot;Longitude&quot;</span><span class="p">),</span> <span class="n">northing</span><span class="p">))</span>

    <span class="bp">self</span><span class="o">.</span><span class="n">coords</span> <span class="o">=</span> <span class="p">[]</span>
    <span class="k">for</span> <span class="n">coord</span> <span class="ow">in</span> <span class="p">(</span><span class="n">xx</span><span class="p">,</span> <span class="n">yy</span><span class="p">):</span>
      <span class="n">sWidget</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QStackedWidget</span><span class="p">()</span>
      <span class="c">#sWidget.setContentsMargins(0, 0, 0, 0)</span>
      <span class="k">for</span> <span class="n">label</span><span class="p">,</span> <span class="n">dw</span><span class="p">,</span> <span class="n">toolTip</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="o">*</span><span class="n">coord</span><span class="p">):</span>
        <span class="c"># Build a Label + Degrees widget</span>
        <span class="n">w</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QWidget</span><span class="p">()</span>
        <span class="c"># Add a layout for lat, long, height</span>
        <span class="n">hlayout</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QHBoxLayout</span><span class="p">()</span>
        <span class="n">hlayout</span><span class="o">.</span><span class="n">setContentsMargins</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
        <span class="c"># The label</span>
        <span class="n">cLabel</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QLabel</span><span class="p">(</span><span class="n">label</span><span class="p">)</span>
        <span class="n">cLabel</span><span class="o">.</span><span class="n">setToolTip</span><span class="p">(</span><span class="n">toolTip</span><span class="p">)</span>
        <span class="n">hlayout</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="n">cLabel</span><span class="p">,</span> <span class="n">alignment</span><span class="o">=</span><span class="n">Qt</span><span class="o">.</span><span class="n">AlignLeft</span><span class="o">|</span><span class="n">Qt</span><span class="o">.</span><span class="n">AlignVCenter</span><span class="p">)</span>
        <span class="c"># add the Degrees widget</span>
        <span class="n">hlayout</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="n">dw</span><span class="p">)</span>
        <span class="n">w</span><span class="o">.</span><span class="n">setLayout</span><span class="p">(</span><span class="n">hlayout</span><span class="p">)</span>
        <span class="c"># add it to the stackedWidget</span>
        <span class="n">sWidget</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="n">w</span><span class="p">)</span>

      <span class="c"># save it into self.coords</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">coords</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">sWidget</span><span class="p">)</span>

    <span class="c"># The file picker: Build a Label + FilePicker widget</span>
    <span class="n">hlayout</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QHBoxLayout</span><span class="p">()</span>
    <span class="n">hlayout</span><span class="o">.</span><span class="n">setContentsMargins</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
    <span class="c"># The label</span>
    <span class="n">hlayout</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="n">QtGui</span><span class="o">.</span><span class="n">QLabel</span><span class="p">(),</span> <span class="n">alignment</span><span class="o">=</span><span class="n">Qt</span><span class="o">.</span><span class="n">AlignLeft</span><span class="o">|</span><span class="n">Qt</span><span class="o">.</span><span class="n">AlignVCenter</span><span class="p">)</span>
    <span class="n">hlayout</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_filePicker</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">pickerWithLabel</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QWidget</span><span class="p">()</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">pickerWithLabel</span><span class="o">.</span><span class="n">setLayout</span><span class="p">(</span><span class="n">hlayout</span><span class="p">)</span>

    <span class="c"># Projection button</span>
    <span class="c">#self.projBtn = QtGui.QPushButton()</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">projBtn</span> <span class="o">=</span> <span class="n">TinyButton</span><span class="p">(</span><span class="s">u&quot;</span><span class="se">\N{DOWNWARDS DOUBLE ARROW}</span><span class="s">&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">projBtn</span><span class="o">.</span><span class="n">clicked</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_selectProj</span><span class="p">)</span>
    <span class="c"># Button is transparent</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">projBtn</span><span class="o">.</span><span class="n">setAutoFillBackground</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
    <span class="c">#self.projBtn.setStyleSheet(&quot;background-color: rgba(255, 255, 255, 0);&quot;)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">projBtn</span><span class="o">.</span><span class="n">setSizePolicy</span><span class="p">(</span><span class="n">QtGui</span><span class="o">.</span><span class="n">QSizePolicy</span><span class="o">.</span><span class="n">Minimum</span><span class="p">,</span>
      <span class="n">QtGui</span><span class="o">.</span><span class="n">QSizePolicy</span><span class="o">.</span><span class="n">Expanding</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">projBtn</span><span class="o">.</span><span class="n">setToolTip</span><span class="p">(</span><span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;datum tooltip&quot;</span><span class="p">,</span>
      <span class="s">&quot;Change current Datum / Projection&quot;</span><span class="p">))</span>

    <span class="c"># a TextEdit to display the PROJ.4 string</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">projLabel</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QTextEdit</span><span class="p">(</span><span class="n">proj</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">projLabel</span><span class="o">.</span><span class="n">setReadOnly</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
    <span class="n">fm</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">projLabel</span><span class="o">.</span><span class="n">fontMetrics</span><span class="p">()</span>
    <span class="n">rowHeight</span> <span class="o">=</span> <span class="n">fm</span><span class="o">.</span><span class="n">lineSpacing</span><span class="p">()</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">projLabel</span><span class="o">.</span><span class="n">setFixedHeight</span><span class="p">(</span><span class="mf">2.6</span> <span class="o">*</span> <span class="n">rowHeight</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">projLabel</span><span class="o">.</span><span class="n">setStyleSheet</span><span class="p">(</span><span class="s">&quot;Text-align:left&quot;</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">projLabel</span><span class="o">.</span><span class="n">setStyleSheet</span><span class="p">(</span><span class="s">&quot;background-color: rgba(255, 255, 255, 160);&quot;</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">projLabel</span><span class="o">.</span><span class="n">setTextInteractionFlags</span><span class="p">(</span><span class="n">Qt</span><span class="o">.</span><span class="n">TextBrowserInteraction</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">projLabel</span><span class="o">.</span><span class="n">setToolTip</span><span class="p">(</span>
      <span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;projTooltip&quot;</span><span class="p">,</span>
      <span class="s">&quot;This is the current Datum / Projection PROJ.4 string&quot;</span><span class="p">))</span>

    <span class="c"># Point Widget</span>
    <span class="n">xyzWidget</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QWidget</span><span class="p">()</span>
    <span class="n">xyzLayout</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QHBoxLayout</span><span class="p">()</span>
    <span class="n">xyzLayout</span><span class="o">.</span><span class="n">setContentsMargins</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
    <span class="n">xyzLayout</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">coords</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">alignment</span><span class="o">=</span><span class="n">Qt</span><span class="o">.</span><span class="n">AlignLeft</span><span class="p">)</span>
    <span class="n">xyzLayout</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">coords</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">alignment</span><span class="o">=</span><span class="n">Qt</span><span class="o">.</span><span class="n">AlignLeft</span><span class="p">)</span>
    <span class="n">xyzLayout</span><span class="o">.</span><span class="n">addLayout</span><span class="p">(</span><span class="n">heightHLayout</span><span class="p">)</span>
    <span class="n">xyzWidget</span><span class="o">.</span><span class="n">setLayout</span><span class="p">(</span><span class="n">xyzLayout</span><span class="p">)</span>

    <span class="c"># The pointOrFileWidget </span>
    <span class="bp">self</span><span class="o">.</span><span class="n">pointOrFileWidget</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QStackedWidget</span><span class="p">()</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">pointOrFileWidget</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="n">xyzWidget</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">pointOrFileWidget</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pickerWithLabel</span><span class="p">)</span>

    <span class="n">inputLayout</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QHBoxLayout</span><span class="p">()</span>
    <span class="n">inputLayout</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pointOrFileWidget</span><span class="p">)</span>

    <span class="n">combosLayout</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QVBoxLayout</span><span class="p">()</span>
    <span class="n">combosLayout</span><span class="o">.</span><span class="n">setContentsMargins</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>

    <span class="c"># Stacked Widget for plane/geographic representation</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">formatStackedWidget</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QStackedWidget</span><span class="p">()</span>

    <span class="c"># Create &quot;Plane&quot; combo</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">planeCombo</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QComboBox</span><span class="p">()</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">planeCombo</span><span class="o">.</span><span class="n">setObjectName</span><span class="p">(</span><span class="s">&quot;planeCombo&quot;</span><span class="p">)</span>

    <span class="c"># Create &quot;Geographic&quot; combo</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">geographicCombo</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QComboBox</span><span class="p">()</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">geographicCombo</span><span class="o">.</span><span class="n">setObjectName</span><span class="p">(</span><span class="s">&quot;geographicCombo&quot;</span><span class="p">)</span>

    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_hasComboU</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_hasComboU</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s">&#39;FILE&#39;</span><span class="p">):</span>
      <span class="n">enableFile</span> <span class="o">=</span> <span class="bp">True</span>
    <span class="k">else</span><span class="p">:</span>
      <span class="n">enableFile</span> <span class="o">=</span> <span class="bp">False</span>

    <span class="bp">self</span><span class="o">.</span><span class="n">formatStackedWidget</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">planeCombo</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">formatStackedWidget</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">geographicCombo</span><span class="p">)</span>
    <span class="n">combosLayout</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">formatStackedWidget</span><span class="p">,</span>
      <span class="n">stretch</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">alignment</span><span class="o">=</span><span class="n">Qt</span><span class="o">.</span><span class="n">AlignLeft</span><span class="p">)</span>

    <span class="c"># Optional combo box for Height representation</span>
    <span class="n">formats</span> <span class="o">=</span> <span class="p">(</span><span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;hcombo&quot;</span><span class="p">,</span> <span class="s">&quot;ell&quot;</span><span class="p">),</span> <span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;hcombo&quot;</span><span class="p">,</span> <span class="s">&quot;ortho&quot;</span><span class="p">))</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">heightCombo</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QComboBox</span><span class="p">()</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">heightCombo</span><span class="o">.</span><span class="n">setToolTip</span><span class="p">(</span><span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;hcombo&quot;</span><span class="p">,</span>
      <span class="s">&quot;Change height representation among</span><span class="se">\n</span><span class="s">&quot;</span>
      <span class="s">&quot;ellipsoidical and orthometric height in meters&quot;</span><span class="p">))</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">heightCombo</span><span class="o">.</span><span class="n">addItems</span><span class="p">(</span><span class="n">formats</span><span class="p">)</span>
    <span class="n">combosLayout</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">heightCombo</span><span class="p">,</span> <span class="n">alignment</span><span class="o">=</span><span class="n">Qt</span><span class="o">.</span><span class="n">AlignLeft</span><span class="p">)</span>


    <span class="c"># Connect Signals</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">heightCombo</span><span class="o">.</span><span class="n">currentIndexChanged</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">setHRep</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">planeCombo</span><span class="o">.</span><span class="n">currentIndexChanged</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_indexChanged</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">geographicCombo</span><span class="o">.</span><span class="n">currentIndexChanged</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_indexChanged</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">enableFileMode</span><span class="p">(</span><span class="n">enableFile</span><span class="p">)</span>

    <span class="n">inputLayout</span><span class="o">.</span><span class="n">addLayout</span><span class="p">(</span><span class="n">combosLayout</span><span class="p">,</span> <span class="n">stretch</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>

    <span class="c"># Set Projection</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">setProj</span><span class="p">(</span><span class="n">proj</span><span class="p">)</span>

    <span class="c"># Build widget layout:</span>
    <span class="n">v</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QVBoxLayout</span><span class="p">()</span>
    <span class="n">coordGroup</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QGroupBox</span><span class="p">(</span><span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;datumGroup&quot;</span><span class="p">,</span>
      <span class="s">&quot;Datum and Projection:&quot;</span><span class="p">))</span>
    <span class="n">g</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QHBoxLayout</span><span class="p">()</span>
    <span class="n">coordGroup</span><span class="o">.</span><span class="n">setFlat</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
    <span class="c">#g.addWidget(self.projLabel, alignment=Qt.AlignTop, stretch=1)</span>
    <span class="n">g</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">projLabel</span><span class="p">,</span> <span class="n">alignment</span><span class="o">=</span><span class="n">Qt</span><span class="o">.</span><span class="n">AlignTop</span><span class="p">)</span>
    <span class="c">#g.addWidget(self.projBtn, alignment=Qt.AlignLeft|Qt.AlignVCenter)</span>
    <span class="n">g</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">projBtn</span><span class="p">,</span> <span class="n">alignment</span><span class="o">=</span><span class="n">Qt</span><span class="o">.</span><span class="n">AlignLeft</span><span class="o">|</span><span class="n">Qt</span><span class="o">.</span><span class="n">AlignTop</span><span class="p">)</span>
    <span class="n">v</span><span class="o">.</span><span class="n">addLayout</span><span class="p">(</span><span class="n">g</span><span class="p">,</span> <span class="n">stretch</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
    <span class="n">v</span><span class="o">.</span><span class="n">addLayout</span><span class="p">(</span><span class="n">inputLayout</span><span class="p">)</span>
    <span class="n">coordGroup</span><span class="o">.</span><span class="n">setLayout</span><span class="p">(</span><span class="n">v</span><span class="p">)</span>
    <span class="n">f</span> <span class="o">=</span> <span class="n">coordGroup</span><span class="o">.</span><span class="n">font</span><span class="p">()</span>
    <span class="n">f</span><span class="o">.</span><span class="n">setBold</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
    <span class="n">coordGroup</span><span class="o">.</span><span class="n">setFont</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>

    <span class="c"># Main layout:</span>
    <span class="n">mainLayout</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QVBoxLayout</span><span class="p">()</span>
    <span class="n">mainLayout</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="n">coordGroup</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">setLayout</span><span class="p">(</span><span class="n">mainLayout</span><span class="p">)</span>

    <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_hasComboU</span><span class="p">:</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">formatStackedWidget</span><span class="o">.</span><span class="n">hide</span><span class="p">()</span>
    <span class="k">if</span> <span class="ow">not</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_hasComboH</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ell2ortho</span><span class="p">):</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">heightCombo</span><span class="o">.</span><span class="n">hide</span><span class="p">()</span>

    <span class="c"># Default is InputMode</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">setFilePickerMode</span><span class="p">(</span><span class="n">FilePicker</span><span class="o">.</span><span class="n">InputMode</span><span class="p">)</span>

    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_mode</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModeFile</span><span class="p">:</span>
      <span class="c"># Show the File Picker</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">showFilePicker</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>

    <span class="c"># Set Combo Boxes</span>
    <span class="c">#self.planeCombo.setCurrentIndex(self.ModeD)</span>
    <span class="c">#self.geographicCombo.setCurrentIndex(self._rep)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">setValue</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="CoordWidget.filePath"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.filePath">[docs]</a>  <span class="k">def</span> <span class="nf">filePath</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Return the File Picker text content</span>

<span class="sd">      :returns: File Picker text content</span>
<span class="sd">      :rtype: string, unicode</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">layout</span><span class="p">,</span> <span class="n">label</span><span class="p">,</span> <span class="n">filePicker</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pickerWithLabel</span><span class="o">.</span><span class="n">children</span><span class="p">()</span>
    <span class="k">return</span> <span class="n">filePicker</span><span class="o">.</span><span class="n">text</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="CoordWidget.filePickerMode"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.filePickerMode">[docs]</a>  <span class="k">def</span> <span class="nf">filePickerMode</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Return the File Picker mode</span>

<span class="sd">      :returns: File Picker mode</span>
<span class="sd">      :rtype: int</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">layout</span><span class="p">,</span> <span class="n">label</span><span class="p">,</span> <span class="n">filePicker</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pickerWithLabel</span><span class="o">.</span><span class="n">children</span><span class="p">()</span>
    <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_filePickerLabels</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">label</span><span class="o">.</span><span class="n">text</span><span class="p">())</span>
</div>
<div class="viewcode-block" id="CoordWidget.enableFileMode"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.enableFileMode">[docs]</a>  <span class="k">def</span> <span class="nf">enableFileMode</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">enable</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Enable / disable `self.ModeFile` in combo box</span>

<span class="sd">      :param enable: enable / disable file mode</span>
<span class="sd">      :type enable: bool</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="c"># Disconnect signals</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">planeCombo</span><span class="o">.</span><span class="n">currentIndexChanged</span><span class="o">.</span><span class="n">disconnect</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_indexChanged</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">geographicCombo</span><span class="o">.</span><span class="n">currentIndexChanged</span><span class="o">.</span><span class="n">disconnect</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_indexChanged</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">planeCombo</span><span class="o">.</span><span class="n">clear</span><span class="p">()</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">geographicCombo</span><span class="o">.</span><span class="n">clear</span><span class="p">()</span>
    <span class="n">planeItems</span> <span class="o">=</span> <span class="p">(</span><span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;plane&quot;</span><span class="p">,</span> <span class="s">&quot;M.MM&quot;</span><span class="p">),</span> <span class="p">)</span>
    <span class="n">planeToolTip</span> <span class="o">=</span> <span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;plane&quot;</span><span class="p">,</span> <span class="s">&quot;Easting, Northing in meters&quot;</span><span class="p">)</span>
    <span class="n">geographicItems</span> <span class="o">=</span> <span class="p">(</span><span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;degs&quot;</span><span class="p">,</span> <span class="s">&quot;D.DD&quot;</span><span class="p">),</span>
      <span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;degs&quot;</span><span class="p">,</span> <span class="s">&quot;D M.MM&quot;</span><span class="p">),</span> <span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;degs&quot;</span><span class="p">,</span> <span class="s">&quot;D M S.SS&quot;</span><span class="p">))</span>
    <span class="n">geographicToolTip</span> <span class="o">=</span> <span class="p">(</span><span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;degs&quot;</span><span class="p">,</span>
      <span class="s">&quot;Change angular representation among</span><span class="se">\n</span><span class="s">&quot;</span>
      <span class="s">&quot;degrees.decimals,</span><span class="se">\n</span><span class="s">degrees, minutes.decimals</span><span class="se">\n</span><span class="s">and degrees, &quot;</span>
      <span class="s">&quot;minutes, seconds.decimals&quot;</span><span class="p">))</span>

    <span class="k">if</span> <span class="n">enable</span><span class="p">:</span>
      <span class="n">extraItem</span> <span class="o">=</span> <span class="p">(</span><span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;file&quot;</span><span class="p">,</span> <span class="s">&quot;File&quot;</span><span class="p">),</span> <span class="p">)</span>
      <span class="n">extraToolTip</span> <span class="o">=</span> <span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;file&quot;</span><span class="p">,</span>
        <span class="s">&quot;</span><span class="se">\n</span><span class="s">Or select File for file conversion&quot;</span><span class="p">)</span>
      <span class="n">planeItems</span> <span class="o">+=</span> <span class="n">extraItem</span>
      <span class="n">planeToolTip</span> <span class="o">+=</span> <span class="n">extraToolTip</span>
      <span class="n">geographicItems</span> <span class="o">+=</span> <span class="n">extraItem</span>
      <span class="n">geographicToolTip</span> <span class="o">+=</span> <span class="n">extraToolTip</span>

    <span class="bp">self</span><span class="o">.</span><span class="n">planeCombo</span><span class="o">.</span><span class="n">addItems</span><span class="p">(</span><span class="n">planeItems</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">planeCombo</span><span class="o">.</span><span class="n">setToolTip</span><span class="p">(</span><span class="n">planeToolTip</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">geographicCombo</span><span class="o">.</span><span class="n">addItems</span><span class="p">(</span><span class="n">geographicItems</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">geographicCombo</span><span class="o">.</span><span class="n">setToolTip</span><span class="p">(</span><span class="n">geographicToolTip</span><span class="p">)</span>

    <span class="c"># Reset current index</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">planeCombo</span><span class="o">.</span><span class="n">setCurrentIndex</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ModeD</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">geographicCombo</span><span class="o">.</span><span class="n">setCurrentIndex</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_rep</span><span class="p">)</span>

    <span class="c"># Reconnect signals</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">planeCombo</span><span class="o">.</span><span class="n">currentIndexChanged</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_indexChanged</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">geographicCombo</span><span class="o">.</span><span class="n">currentIndexChanged</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_indexChanged</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="CoordWidget.setFilePickerMode"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.setFilePickerMode">[docs]</a>  <span class="k">def</span> <span class="nf">setFilePickerMode</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">mode</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Set the File Picker mode</span>

<span class="sd">      :param mode: set File Picker mode to `mode`</span>
<span class="sd">      :type mode: int</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">layout</span><span class="p">,</span> <span class="n">label</span><span class="p">,</span> <span class="n">filePicker</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pickerWithLabel</span><span class="o">.</span><span class="n">children</span><span class="p">()</span>
    <span class="n">label</span><span class="o">.</span><span class="n">setText</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_filePickerLabels</span><span class="p">[</span><span class="n">mode</span><span class="p">])</span>
    <span class="n">label</span><span class="o">.</span><span class="n">setToolTip</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_filePickerLabels</span><span class="p">[</span><span class="n">mode</span><span class="p">])</span>
    <span class="n">filePicker</span><span class="o">.</span><span class="n">setMode</span><span class="p">(</span><span class="n">mode</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="CoordWidget.pointChanged"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.pointChanged">[docs]</a>  <span class="k">def</span> <span class="nf">pointChanged</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">newValue</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Emit a `changedSignal` Signal with &#39;point&#39; argument.</span>

<span class="sd">        newValue argument is discarded.</span>

<span class="sd">      :param newValue: argument is discarded</span>
<span class="sd">      :type newValue: string</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">changedSignal</span><span class="o">.</span><span class="n">emit</span><span class="p">(</span><span class="s">&#39;point&#39;</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="CoordWidget.fpChanged"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.fpChanged">[docs]</a>  <span class="k">def</span> <span class="nf">fpChanged</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">newPath</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Emit a `fileChangedSignal` Signal with `newPath` argument.</span>

<span class="sd">      :param newPath: new file path</span>
<span class="sd">      :type newPath: string, unicode</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">if</span> <span class="n">newPath</span><span class="p">:</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">fileChangedSignal</span><span class="o">.</span><span class="n">emit</span><span class="p">(</span><span class="n">newPath</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="CoordWidget.datumShift"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.datumShift">[docs]</a>  <span class="k">def</span> <span class="nf">datumShift</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Return Datum Shift for this point</span>

<span class="sd">      :returns: Datum Shift for this point</span>
<span class="sd">      :rtype: float</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_datumShift</span>
</div>
<div class="viewcode-block" id="CoordWidget.geoidGrid"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.geoidGrid">[docs]</a>  <span class="k">def</span> <span class="nf">geoidGrid</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Return Geoid Grid for this point</span>

<span class="sd">      :returns: Geoid Grid for this point</span>
<span class="sd">      :rtype: float</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_geoidGrid</span>
</div>
<div class="viewcode-block" id="CoordWidget.setEll2Ortho"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.setEll2Ortho">[docs]</a>  <span class="k">def</span> <span class="nf">setEll2Ortho</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ell2Ortho</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Set ellipsoidical to orthometric height (geoid) difference</span>

<span class="sd">      :param ell2Ortho: ellipsoidical to orthometric height (geoid) difference</span>
<span class="sd">      :type ell2Ortho: float or None</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">_ell2ortho</span> <span class="o">=</span> <span class="n">ell2Ortho</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="o">.</span><span class="n">setEll2Ortho</span><span class="p">(</span><span class="n">ell2Ortho</span><span class="p">)</span>
    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ell2ortho</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">heightCombo</span><span class="o">.</span><span class="n">hide</span><span class="p">()</span>
    <span class="k">else</span><span class="p">:</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">heightCombo</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="CoordWidget.setValue"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.setValue">[docs]</a>  <span class="k">def</span> <span class="nf">setValue</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">values</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Set Latitude, Longitude, Height [ell2Ortho] **OR**</span>
<span class="sd">        Easting, Northing, Height [ell2Ortho]</span>

<span class="sd">      :param \*values: Latitude, Longitude, Height [ell2Ortho]</span>
<span class="sd">      :type \*values: float</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">isLatLon</span><span class="p">():</span>
      <span class="k">for</span> <span class="n">w</span><span class="p">,</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">((</span><span class="bp">self</span><span class="o">.</span><span class="n">lonWidget</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">latWidget</span><span class="p">),</span> <span class="nb">xrange</span><span class="p">(</span><span class="mi">3</span><span class="p">)):</span>
        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">values</span><span class="p">[</span><span class="n">j</span><span class="p">],</span> <span class="s">&#39;__iter__&#39;</span><span class="p">):</span>
          <span class="n">w</span><span class="o">.</span><span class="n">setValue</span><span class="p">(</span><span class="o">*</span><span class="n">values</span><span class="p">[</span><span class="n">j</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
          <span class="n">w</span><span class="o">.</span><span class="n">setValue</span><span class="p">(</span><span class="n">values</span><span class="p">[</span><span class="n">j</span><span class="p">])</span>
    <span class="k">else</span><span class="p">:</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">eWidget</span><span class="o">.</span><span class="n">setValue</span><span class="p">(</span><span class="n">values</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">nWidget</span><span class="o">.</span><span class="n">setValue</span><span class="p">(</span><span class="n">values</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>

    <span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="o">.</span><span class="n">setEllH</span><span class="p">(</span><span class="n">values</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
</div>
<div class="viewcode-block" id="CoordWidget.isFilePickerShown"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.isFilePickerShown">[docs]</a>  <span class="k">def</span> <span class="nf">isFilePickerShown</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Return True if the File Picker is shown</span>

<span class="sd">      :returns: True if the File Picker is shown</span>
<span class="sd">      :rtype: bool</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pointOrFileWidget</span><span class="o">.</span><span class="n">currentIndex</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">FileIndex</span><span class="p">:</span>
      <span class="k">return</span> <span class="bp">True</span>
    <span class="k">else</span><span class="p">:</span>
      <span class="k">return</span> <span class="bp">False</span>
</div>
<div class="viewcode-block" id="CoordWidget.showFilePicker"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.showFilePicker">[docs]</a>  <span class="k">def</span> <span class="nf">showFilePicker</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">showIt</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; If `showIt` evaluates True set widget mode to show the File Picker,</span>
<span class="sd">        else show coordinates widget</span>

<span class="sd">      :param showIt: set widget mode to show the File Picker if True</span>
<span class="sd">      :type showIt: bool</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">if</span> <span class="n">showIt</span><span class="p">:</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">pointOrFileWidget</span><span class="o">.</span><span class="n">setCurrentIndex</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">FileIndex</span><span class="p">)</span>
    <span class="k">else</span><span class="p">:</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">pointOrFileWidget</span><span class="o">.</span><span class="n">setCurrentIndex</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">PointIndex</span><span class="p">)</span>
</div>
  <span class="k">def</span> <span class="nf">_indexChanged</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">index</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Index changed in the combo boxes: set appropriate representation</span>

<span class="sd">      :param index: new index in the ComboBox</span>
<span class="sd">      :type index: int</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">if</span> <span class="n">index</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
      <span class="k">return</span>

    <span class="n">rep</span> <span class="o">=</span> <span class="bp">None</span>
    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">sender</span><span class="p">()</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">planeCombo</span><span class="p">:</span>
      <span class="k">if</span> <span class="n">index</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">changedSignal</span><span class="o">.</span><span class="n">emit</span><span class="p">(</span><span class="s">&#39;File On&#39;</span><span class="p">)</span>
      <span class="k">else</span><span class="p">:</span>
        <span class="n">rep</span> <span class="o">=</span> <span class="n">index</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">changedSignal</span><span class="o">.</span><span class="n">emit</span><span class="p">(</span><span class="s">&#39;File Off&#39;</span><span class="p">)</span>
    <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">sender</span><span class="p">()</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">geographicCombo</span><span class="p">:</span>
      <span class="k">if</span> <span class="n">index</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModeFile</span><span class="p">:</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">changedSignal</span><span class="o">.</span><span class="n">emit</span><span class="p">(</span><span class="s">&#39;File On&#39;</span><span class="p">)</span>
      <span class="k">else</span><span class="p">:</span>
        <span class="n">rep</span> <span class="o">=</span> <span class="n">index</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">changedSignal</span><span class="o">.</span><span class="n">emit</span><span class="p">(</span><span class="s">&#39;File Off&#39;</span><span class="p">)</span>
    <span class="k">else</span><span class="p">:</span>
      <span class="k">raise</span> <span class="ne">SystemExit</span><span class="p">(</span><span class="s">&quot;FATAL ERROR..... _indexChanged: Invalid sender </span><span class="si">%s</span><span class="s">!&quot;</span> <span class="o">%</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">sender</span><span class="p">()</span><span class="o">.</span><span class="n">objectName</span><span class="p">())</span>

    <span class="k">if</span> <span class="n">rep</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">setDRep</span><span class="p">(</span><span class="n">rep</span><span class="p">)</span>

<div class="viewcode-block" id="CoordWidget.setDRep"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.setDRep">[docs]</a>  <span class="k">def</span> <span class="nf">setDRep</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">rep</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Set Degrees representation to rep if :attr:`isLatLon()` evaluates to</span>
<span class="sd">        True, else...</span>

<span class="sd">      :param rep: representation to use for latLon or plane coordinates</span>
<span class="sd">      :type rep: :class:`ModeD` .. :class:`ModeDMS`</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">isLatLon</span><span class="p">():</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">latWidget</span><span class="o">.</span><span class="n">setRep</span><span class="p">(</span><span class="n">rep</span><span class="p">)</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">lonWidget</span><span class="o">.</span><span class="n">setRep</span><span class="p">(</span><span class="n">rep</span><span class="p">)</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">_rep</span> <span class="o">=</span> <span class="n">rep</span>
</div>
<div class="viewcode-block" id="CoordWidget.setHRep"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.setHRep">[docs]</a>  <span class="k">def</span> <span class="nf">setHRep</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">rep</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Set Height representation to rep</span>

<span class="sd">      :param rep: representation to use for height</span>
<span class="sd">      :type rep: :class:`RepEll` .. :class:`RepOrtho`</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="o">.</span><span class="n">setRep</span><span class="p">(</span><span class="n">rep</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="CoordWidget.tvalue"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.tvalue">[docs]</a>  <span class="k">def</span> <span class="nf">tvalue</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Return widget value as tuples of text</span>

<span class="sd">      :returns: widget value as tuples of text</span>
<span class="sd">      :rtype: tuple</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">isLatLon</span><span class="p">():</span>
      <span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">latWidget</span><span class="o">.</span><span class="n">tvalue</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">lonWidget</span><span class="o">.</span><span class="n">tvalue</span><span class="p">(),</span>
        <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="o">.</span><span class="n">ellH</span><span class="p">()),</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="o">.</span><span class="n">ell2Ortho</span><span class="p">()))]</span>
    <span class="k">else</span><span class="p">:</span>
      <span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">eWidget</span><span class="o">.</span><span class="n">tvalue</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">nWidget</span><span class="o">.</span><span class="n">tvalue</span><span class="p">(),</span>
        <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="o">.</span><span class="n">ellH</span><span class="p">()),</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="o">.</span><span class="n">ell2Ortho</span><span class="p">()))]</span>
</div>
<div class="viewcode-block" id="CoordWidget.fvalue"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.fvalue">[docs]</a>  <span class="k">def</span> <span class="nf">fvalue</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Return widget value as tuples of float</span>

<span class="sd">      :returns: widget value as tuples of float</span>
<span class="sd">      :rtype: tuple</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">isLatLon</span><span class="p">():</span>
      <span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">latWidget</span><span class="o">.</span><span class="n">fvalue</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">lonWidget</span><span class="o">.</span><span class="n">fvalue</span><span class="p">(),</span>
        <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="o">.</span><span class="n">ellH</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="o">.</span><span class="n">ell2Ortho</span><span class="p">())]</span>
    <span class="k">else</span><span class="p">:</span>
      <span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">eWidget</span><span class="o">.</span><span class="n">fvalue</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">nWidget</span><span class="o">.</span><span class="n">fvalue</span><span class="p">(),</span>
        <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="o">.</span><span class="n">ellH</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="o">.</span><span class="n">ell2Ortho</span><span class="p">())]</span>
</div>
<div class="viewcode-block" id="CoordWidget.svalue"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.svalue">[docs]</a>  <span class="k">def</span> <span class="nf">svalue</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Return widget value as tuple of strings</span>

<span class="sd">      :returns: widget value as tuples of strings</span>
<span class="sd">      :rtype: tuple</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">isLatLon</span><span class="p">():</span>
      <span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">latWidget</span><span class="o">.</span><span class="n">svalue</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">lonWidget</span><span class="o">.</span><span class="n">svalue</span><span class="p">(),</span>
        <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="o">.</span><span class="n">ellH</span><span class="p">()),</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="o">.</span><span class="n">ell2Ortho</span><span class="p">()))]</span>
    <span class="k">else</span><span class="p">:</span>
      <span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">eWidget</span><span class="o">.</span><span class="n">svalue</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">nWidget</span><span class="o">.</span><span class="n">svalue</span><span class="p">(),</span>
        <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="o">.</span><span class="n">ellH</span><span class="p">()),</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="o">.</span><span class="n">ell2Ortho</span><span class="p">()))]</span>
</div>
<div class="viewcode-block" id="CoordWidget.xyz"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.xyz">[docs]</a>  <span class="k">def</span> <span class="nf">xyz</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Return either</span>

<span class="sd">          * longitude, latitude, height</span>
<span class="sd">          * easting, northing, height</span>

<span class="sd">        according to :class:`isLatLon()`</span>

<span class="sd">      :returns: x, y, z</span>
<span class="sd">      :rtype: tuple</span>
<span class="sd">      :raises:</span>

<span class="sd">     .. note:: Height is always **ELLIPSOIDICAL**.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">isLatLon</span><span class="p">():</span>
      <span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">lonWidget</span><span class="o">.</span><span class="n">fvalue</span><span class="p">(</span><span class="mi">0</span><span class="p">)[</span><span class="mi">0</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">latWidget</span><span class="o">.</span><span class="n">fvalue</span><span class="p">(</span><span class="mi">0</span><span class="p">)[</span><span class="mi">0</span><span class="p">],</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="o">.</span><span class="n">ellH</span><span class="p">()]</span>
    <span class="k">else</span><span class="p">:</span>
      <span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">eWidget</span><span class="o">.</span><span class="n">fvalue</span><span class="p">(</span><span class="mi">0</span><span class="p">)[</span><span class="mi">0</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">nWidget</span><span class="o">.</span><span class="n">fvalue</span><span class="p">(</span><span class="mi">0</span><span class="p">)[</span><span class="mi">0</span><span class="p">],</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="o">.</span><span class="n">ellH</span><span class="p">()]</span>
</div>
  <span class="k">def</span> <span class="nf">_selectProj</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Open a dialog to select datum and projection</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">dlg</span> <span class="o">=</span> <span class="n">ProjDialog</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">projStr</span><span class="p">(),</span> <span class="bp">self</span><span class="p">)</span>
    <span class="n">dlg</span><span class="o">.</span><span class="n">resize</span><span class="p">(</span><span class="mi">640</span><span class="p">,</span> <span class="mi">480</span><span class="p">)</span>
    <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">exec_</span><span class="p">():</span>
      <span class="n">projStr</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">projection</span><span class="p">()</span>
      <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">setProj</span><span class="p">(</span><span class="n">projStr</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">changedSignal</span><span class="o">.</span><span class="n">emit</span><span class="p">(</span><span class="s">&#39;proj&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">adjustSize</span><span class="p">()</span>

<div class="viewcode-block" id="CoordWidget.ell2Ortho"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.ell2Ortho">[docs]</a>  <span class="k">def</span> <span class="nf">ell2Ortho</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Return ellipsoidical to orthometric height difference</span>

<span class="sd">      :returns: ellipsoidical to orthometric height difference</span>
<span class="sd">      :rtype: float or None</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="o">.</span><span class="n">ell2Ortho</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="CoordWidget.isLatLon"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.isLatLon">[docs]</a>  <span class="k">def</span> <span class="nf">isLatLon</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Return True if projection is in geographic coordinates</span>

<span class="sd">      :returns: True if projection is in geographic coordinates</span>
<span class="sd">      :rtype: bool</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_proj</span><span class="o">.</span><span class="n">is_latlong</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="CoordWidget.proj"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.proj">[docs]</a>  <span class="k">def</span> <span class="nf">proj</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Return proj object for this point</span>

<span class="sd">      :returns: proj object for this point</span>
<span class="sd">      :rtype: pyproj instance</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_proj</span>
</div>
<div class="viewcode-block" id="CoordWidget.projStr"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.projStr">[docs]</a>  <span class="k">def</span> <span class="nf">projStr</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Return proj srs string for this point</span>

<span class="sd">      :returns: proj srs string for this point</span>
<span class="sd">      :rtype: string</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">version</span> <span class="o">=</span> <span class="n">__version__</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)</span>
    <span class="k">if</span> <span class="n">version</span> <span class="o">&lt;</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">0</span><span class="p">):</span>
      <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_proj</span><span class="o">.</span><span class="n">srs</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s">&#39;+units=m &#39;</span><span class="p">,</span> <span class="s">&#39;&#39;</span><span class="p">)</span>
    <span class="k">else</span><span class="p">:</span>
      <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_proj</span><span class="o">.</span><span class="n">srs</span>
</div>
<div class="viewcode-block" id="CoordWidget.projString"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.projString">[docs]</a>  <span class="k">def</span> <span class="nf">projString</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Return full proj string (with geoidgrids and datumShifts)</span>

<span class="sd">      :returns: proj string (with geoidgrids and datumShifts)</span>
<span class="sd">      :rtype: string</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_projString</span>
</div>
<div class="viewcode-block" id="CoordWidget.setProj"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.setProj">[docs]</a>  <span class="k">def</span> <span class="nf">setProj</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">projS</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Set projection for this point and return it if ok else False</span>

<span class="sd">      :param projS: PROJ.4 string defining Datum / Projection</span>
<span class="sd">      :type projS: string</span>
<span class="sd">      :returns: projection for this point or False</span>
<span class="sd">      :rtype: string or False</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">_projString</span> <span class="o">=</span> <span class="n">projS</span>
    <span class="n">retval</span> <span class="o">=</span> <span class="bp">False</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">_datumShift</span> <span class="o">=</span> <span class="bp">None</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">_geoidGrid</span> <span class="o">=</span> <span class="bp">None</span>
    <span class="n">cleanProjS</span> <span class="o">=</span> <span class="n">projS</span>

    <span class="c"># Search for extra keyword(s)</span>
    <span class="k">for</span> <span class="n">extraKeyword</span> <span class="ow">in</span> <span class="n">EXTRA_KEYWORDS</span><span class="p">:</span>
      <span class="n">b</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">e</span> <span class="o">=</span> <span class="n">projS</span><span class="o">.</span><span class="n">partition</span><span class="p">(</span><span class="n">extraKeyword</span><span class="p">)</span>
      <span class="k">if</span> <span class="n">key</span> <span class="o">==</span> <span class="n">DATUMSHIFT_KEYWORD</span><span class="p">:</span>
        <span class="c"># extra keyword found, parse its value</span>
        <span class="n">pn</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">split</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span>
        <span class="k">try</span><span class="p">:</span>
          <span class="bp">self</span><span class="o">.</span><span class="n">_datumShift</span> <span class="o">=</span> <span class="n">DatumShift</span><span class="p">(</span><span class="n">pn</span><span class="p">)</span>
        <span class="k">except</span> <span class="ne">IOError</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span>
          <span class="n">msgBox</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QMessageBox</span><span class="p">(</span><span class="n">QtGui</span><span class="o">.</span><span class="n">QMessageBox</span><span class="o">.</span><span class="n">Warning</span><span class="p">,</span>
            <span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;datumMbox&quot;</span><span class="p">,</span> <span class="s">&#39;IO Error&#39;</span><span class="p">),</span>
            <span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;datumMbox&quot;</span><span class="p">,</span>
            <span class="s">&quot;Cannot load datum shift file &#39;</span><span class="si">%s</span><span class="s">&#39;.</span><span class="se">\n</span><span class="s">The reason is:</span><span class="se">\n</span><span class="si">%s</span><span class="s">.&quot;</span><span class="p">)</span> <span class="o">%</span>
            <span class="p">(</span><span class="n">pn</span><span class="p">,</span> <span class="n">e</span><span class="p">),</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QMessageBox</span><span class="o">.</span><span class="n">Ok</span><span class="p">)</span>
          <span class="n">msgBox</span><span class="o">.</span><span class="n">exec_</span><span class="p">()</span>
          <span class="k">return</span> <span class="n">retval</span>
        <span class="k">else</span><span class="p">:</span>
          <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_datumShift</span><span class="o">.</span><span class="n">datumShift</span><span class="p">()</span> <span class="o">==</span> <span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_datumShift</span> <span class="o">=</span> <span class="bp">None</span>
            <span class="n">msgBox</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QMessageBox</span><span class="p">(</span><span class="n">QtGui</span><span class="o">.</span><span class="n">QMessageBox</span><span class="o">.</span><span class="n">Warning</span><span class="p">,</span>
              <span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;datumMbox&quot;</span><span class="p">,</span> <span class="s">&#39;Datum Shift Error&#39;</span><span class="p">),</span>
              <span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;datumMbox&quot;</span><span class="p">,</span>
                <span class="s">&quot;&#39;</span><span class="si">%s</span><span class="s">&#39; is not a valid Datum Shift file.&quot;</span><span class="p">)</span> <span class="o">%</span> <span class="p">(</span><span class="n">pn</span><span class="p">),</span>
              <span class="n">QtGui</span><span class="o">.</span><span class="n">QMessageBox</span><span class="o">.</span><span class="n">Ok</span><span class="p">)</span>
            <span class="n">msgBox</span><span class="o">.</span><span class="n">exec_</span><span class="p">()</span>
            <span class="k">return</span> <span class="n">retval</span>
          <span class="c"># Remove extra from the string</span>
          <span class="n">cleanProjS</span> <span class="o">=</span> <span class="n">cleanProjS</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">extraKeyword</span> <span class="o">+</span> <span class="n">pn</span><span class="p">,</span> <span class="s">&#39;&#39;</span><span class="p">)</span>
      <span class="k">elif</span> <span class="n">key</span> <span class="o">==</span> <span class="n">GEOIDGRIDS_KEYWORD</span><span class="p">:</span>
        <span class="c"># extra keyword found, parse its value</span>
        <span class="n">pn</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">split</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span>
        <span class="k">try</span><span class="p">:</span>
          <span class="bp">self</span><span class="o">.</span><span class="n">_geoidGrid</span> <span class="o">=</span> <span class="n">Geoid</span><span class="p">(</span><span class="n">pn</span><span class="p">)</span>
        <span class="k">except</span> <span class="ne">IOError</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span>
          <span class="n">msgBox</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QMessageBox</span><span class="p">(</span><span class="n">QtGui</span><span class="o">.</span><span class="n">QMessageBox</span><span class="o">.</span><span class="n">Warning</span><span class="p">,</span>
            <span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;geoidMbox&quot;</span><span class="p">,</span> <span class="s">&#39;IO Error&#39;</span><span class="p">),</span>
            <span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;geoidMbox&quot;</span><span class="p">,</span>
            <span class="s">&quot;Cannot load geoid grid file &#39;</span><span class="si">%s</span><span class="s">&#39;.</span><span class="se">\n</span><span class="s">The reason is:</span><span class="se">\n</span><span class="si">%s</span><span class="s">.&quot;</span><span class="p">)</span> <span class="o">%</span>
            <span class="p">(</span><span class="n">pn</span><span class="p">,</span> <span class="n">e</span><span class="p">),</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QMessageBox</span><span class="o">.</span><span class="n">Ok</span><span class="p">)</span>
          <span class="n">msgBox</span><span class="o">.</span><span class="n">exec_</span><span class="p">()</span>
          <span class="k">return</span> <span class="n">retval</span>
        <span class="k">else</span><span class="p">:</span>
          <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_geoidGrid</span><span class="o">.</span><span class="n">geoid</span><span class="p">()</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_geoidGrid</span> <span class="o">=</span> <span class="bp">None</span>
            <span class="n">msgBox</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QMessageBox</span><span class="p">(</span><span class="n">QtGui</span><span class="o">.</span><span class="n">QMessageBox</span><span class="o">.</span><span class="n">Warning</span><span class="p">,</span>
              <span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;geoidMbox&quot;</span><span class="p">,</span> <span class="s">&#39;Geoid Grid Error&#39;</span><span class="p">),</span>
              <span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;geoidMbox&quot;</span><span class="p">,</span>
              <span class="s">&quot;&#39;</span><span class="si">%s</span><span class="s">&#39; is not a valid Geoid Grid file.&quot;</span><span class="p">)</span> <span class="o">%</span> <span class="p">(</span><span class="n">pn</span><span class="p">),</span>
              <span class="n">QtGui</span><span class="o">.</span><span class="n">QMessageBox</span><span class="o">.</span><span class="n">Ok</span><span class="p">)</span>
            <span class="n">msgBox</span><span class="o">.</span><span class="n">exec_</span><span class="p">()</span>
            <span class="k">return</span> <span class="n">retval</span>
          <span class="c"># Remove extra from the string</span>
          <span class="n">cleanProjS</span> <span class="o">=</span> <span class="n">cleanProjS</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">extraKeyword</span> <span class="o">+</span> <span class="n">pn</span><span class="p">,</span> <span class="s">&#39;&#39;</span><span class="p">)</span>

    <span class="k">try</span><span class="p">:</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">_proj</span> <span class="o">=</span> <span class="n">Proj</span><span class="p">(</span><span class="n">cleanProjS</span><span class="p">,</span> <span class="n">preserve_units</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
    <span class="k">except</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span>
      <span class="n">msgBox</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QMessageBox</span><span class="p">(</span><span class="n">QtGui</span><span class="o">.</span><span class="n">QMessageBox</span><span class="o">.</span><span class="n">Warning</span><span class="p">,</span>
        <span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;projMbox&quot;</span><span class="p">,</span> <span class="s">&#39;Invalid PROJ.4 string&#39;</span><span class="p">),</span>
        <span class="n">QCA</span><span class="o">.</span><span class="n">translate</span><span class="p">(</span><span class="s">&quot;projMbox&quot;</span><span class="p">,</span>
        <span class="s">&quot;&#39;</span><span class="si">%s</span><span class="s">&#39; is an invalid PROJ.4 string.</span><span class="se">\n</span><span class="s">The reason is:</span><span class="se">\n</span><span class="si">%s</span><span class="s">.&quot;</span><span class="p">)</span> <span class="o">%</span>
        <span class="p">(</span><span class="n">projS</span><span class="p">,</span> <span class="n">e</span><span class="p">),</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QMessageBox</span><span class="o">.</span><span class="n">Ok</span><span class="p">)</span>
      <span class="n">msgBox</span><span class="o">.</span><span class="n">exec_</span><span class="p">()</span>
    <span class="k">else</span><span class="p">:</span>
      <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_proj</span><span class="o">.</span><span class="n">is_latlong</span><span class="p">():</span>
        <span class="n">index</span> <span class="o">=</span> <span class="mi">0</span>
      <span class="k">else</span><span class="p">:</span>
        <span class="n">index</span> <span class="o">=</span> <span class="mi">1</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">coords</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">setCurrentIndex</span><span class="p">(</span><span class="n">index</span><span class="p">)</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">coords</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">setCurrentIndex</span><span class="p">(</span><span class="n">index</span><span class="p">)</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">projLabel</span><span class="o">.</span><span class="n">setText</span><span class="p">(</span><span class="n">projS</span><span class="p">)</span>
      <span class="n">retval</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_proj</span>

    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">isLatLon</span><span class="p">():</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">formatStackedWidget</span><span class="o">.</span><span class="n">setCurrentIndex</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">GeographicIndex</span><span class="p">)</span>
    <span class="k">else</span><span class="p">:</span>
      <span class="bp">self</span><span class="o">.</span><span class="n">formatStackedWidget</span><span class="o">.</span><span class="n">setCurrentIndex</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">PlaneIndex</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">retval</span>
</div>
<div class="viewcode-block" id="CoordWidget.decimals"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.decimals">[docs]</a>  <span class="k">def</span> <span class="nf">decimals</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Return x, y, z decimals for representation as tuples</span>

<span class="sd">      :returns: decimals for representation of x, y, z</span>
<span class="sd">      :rtype: tuple (of  tuples)</span>
<span class="sd">      :raises:</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">isLatLon</span><span class="p">():</span>
      <span class="n">rep</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">geographicCombo</span><span class="o">.</span><span class="n">currentIndex</span><span class="p">()</span>
      <span class="k">if</span> <span class="n">rep</span> <span class="o">==</span> <span class="n">DegreesWidget</span><span class="o">.</span><span class="n">DDD</span><span class="p">:</span>
        <span class="n">xdecimals</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">lonWidget</span><span class="o">.</span><span class="n">ddecimals</span><span class="p">,</span> <span class="p">)</span>
        <span class="n">ydecimals</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">latWidget</span><span class="o">.</span><span class="n">ddecimals</span><span class="p">,</span> <span class="p">)</span>
      <span class="k">elif</span> <span class="n">rep</span> <span class="o">==</span> <span class="n">DegreesWidget</span><span class="o">.</span><span class="n">DMM</span><span class="p">:</span>
        <span class="n">xdecimals</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">lonWidget</span><span class="o">.</span><span class="n">mdecimals</span><span class="p">)</span>
        <span class="n">ydecimals</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">latWidget</span><span class="o">.</span><span class="n">mdecimals</span><span class="p">)</span>
      <span class="k">elif</span> <span class="n">rep</span> <span class="o">==</span> <span class="n">DegreesWidget</span><span class="o">.</span><span class="n">DMS</span><span class="p">:</span>
        <span class="n">xdecimals</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">lonWidget</span><span class="o">.</span><span class="n">sdecimals</span><span class="p">)</span>
        <span class="n">ydecimals</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">latWidget</span><span class="o">.</span><span class="n">sdecimals</span><span class="p">)</span>
    <span class="k">else</span><span class="p">:</span>
      <span class="n">xdecimals</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">eWidget</span><span class="o">.</span><span class="n">decimals</span>
      <span class="n">ydecimals</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">nWidget</span><span class="o">.</span><span class="n">decimals</span>
    <span class="n">zdecimals</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">heightWidget</span><span class="o">.</span><span class="n">decimals</span>
    <span class="k">return</span> <span class="n">xdecimals</span><span class="p">,</span> <span class="n">ydecimals</span><span class="p">,</span> <span class="n">zdecimals</span>
</div>
<div class="viewcode-block" id="CoordWidget.coordFormat"><a class="viewcode-back" href="../../ccqw.html#ccqw.coordWidget.CoordWidget.coordFormat">[docs]</a>  <span class="k">def</span> <span class="nf">coordFormat</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot; Return format of coordinates as shown in the comboBox</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">isLatLon</span><span class="p">():</span>
      <span class="n">combo</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">geographicCombo</span>
    <span class="k">else</span><span class="p">:</span>
      <span class="n">combo</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">planeCombo</span>
    <span class="n">index</span> <span class="o">=</span> <span class="n">combo</span><span class="o">.</span><span class="n">currentIndex</span><span class="p">()</span>
    <span class="n">allItems</span> <span class="o">=</span> <span class="p">[</span><span class="n">combo</span><span class="o">.</span><span class="n">itemText</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">combo</span><span class="o">.</span><span class="n">count</span><span class="p">())]</span>
    <span class="k">return</span> <span class="n">allItems</span><span class="p">[</span><span class="n">index</span><span class="p">]</span>
</div></div>
<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;__main__&#39;</span><span class="p">:</span>
  <span class="kn">from</span> <span class="nn">signal</span> <span class="kn">import</span> <span class="n">signal</span><span class="p">,</span> <span class="n">SIGINT</span><span class="p">,</span> <span class="n">SIG_DFL</span>

  <span class="n">signal</span><span class="p">(</span><span class="n">SIGINT</span><span class="p">,</span> <span class="n">SIG_DFL</span><span class="p">)</span>
  <span class="n">app</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QApplication</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">)</span>
  <span class="c"># LatLong</span>
  <span class="n">x</span> <span class="o">=</span> <span class="p">(</span><span class="mf">13.</span><span class="p">,</span> <span class="mf">45.81882</span><span class="p">)</span>
  <span class="n">y</span> <span class="o">=</span> <span class="p">(</span><span class="mf">45.710551</span><span class="p">,)</span>
  <span class="n">z</span> <span class="o">=</span> <span class="mf">285.8</span>
  <span class="n">w1</span> <span class="o">=</span> <span class="n">CoordWidget</span><span class="p">((</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">),</span> <span class="n">comboU</span><span class="o">=</span><span class="s">&#39;File&#39;</span><span class="p">,)</span>
  <span class="c"># Plane</span>
  <span class="n">x</span> <span class="o">=</span> <span class="mi">4000000</span>
  <span class="n">y</span> <span class="o">=</span> <span class="mi">50000000</span>
  <span class="n">z</span> <span class="o">=</span> <span class="mf">285.8</span>
  <span class="n">w2</span> <span class="o">=</span> <span class="n">CoordWidget</span><span class="p">((</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">),</span> <span class="n">comboU</span><span class="o">=</span><span class="s">&#39;File&#39;</span><span class="p">,</span>
    <span class="n">proj</span><span class="o">=</span><span class="s">&#39;+proj=utm +zone=33 +ellps=WGS84 +datum=WGS84 +no_defs&#39;</span><span class="p">,)</span>
    <span class="c">#mode=CoordWidget.FileMode,</span>
    <span class="c">#projTo=&quot;+proj=longlat +ellps=intl +pm=rome +no_defs&quot;,</span>
    <span class="c">#projTo=&quot;+init=epsg:3004 +towgs84=-122.74,-34.27,-22.83,&quot;</span>
    <span class="c">#&quot;-1.884,-3.400,-3.030,-15.62&quot;,</span>
    <span class="c">#ell2Ortho=None, name=&quot;Molo Sartorio&quot;,)</span>
    <span class="c">#dmsChars=[&#39;&#39;, &#39;&#39;, &#39;&#39;])</span>
  <span class="c">#dialog.selectFields(&quot;/home/vidmar/Geod/qt/Molo_Sartorio_UTM33.xyz&quot;, False,</span>
  <span class="c">#  None, &quot;filippo&quot;)</span>
  <span class="n">w1</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
  <span class="n">w2</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
  <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="n">app</span><span class="o">.</span><span class="n">exec_</span><span class="p">())</span>
</pre></div>

          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../index.html">
              <img class="logo" src="../../_static/ogs.png" alt="Logo"/>
            </a></p>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li><a href="../../index.html">CCQW 0.1.1 documentation</a> &raquo;</li>
          <li><a href="../index.html" >Module code</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2012, Roberto Vidmar, Nicola Creati.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
  </body>
</html>